<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="test">
    <div class="time-part">
        <div id="time" class="now-time"></div>
    </div>
</div>

</body>
<script>
    function getTime(){
       var now =new Date();
        //年
        var year = now.getFullYear();
        //月
        var month = now.getMonth();
        //日
        var day = now.getDate();
        //周
        var week = now.getDay();
        //十
        var hours = now.getHours();
        //分
        var minutes = now.getMinutes();
        //秒
        var seconds =  now.getSeconds();
        var curTime = year+ "年" + month+"月"+day+"日"+hours+"时"+minutes+"分"+seconds+"秒"+",星期"+week;
        document.getElementById("time").innerHTML = "今天是"+curTime;
        setInterval("getTime()",1000);
    }
    getTime();

</script>
<style>
    html,body{
        width: 100%;
        height: 100%;
        margin:0;
    }
    .test{
        background-image: url("./images/1.jpg");
        background-repeat: no-repeat;
        background-size: cover;
        width: 100%;
        height: 100%;
    }
    .time-part{
        position: relative;
        width: 100%;
        height: 100%;
    }
    .time-part .now-time{
        color: darkgoldenrod;
        font-size: 25px;
        font-weight: bold;
        position: absolute;
        left:50%;
        top: 50%;
        transform: translate(-50%,-50%);
    }
</style>
</html>